class Animal{
    String name;
    int age;
    static{
        System.out.println("Animal（父类）的静态代码块");
    }
    {
        System.out.println("Animal（父类）的实例代码块");
    }
    public Animal(String myname,int myage){
        name=myname;
        age=myage;
        System.out.println("Animal（父类）的构造");
    }
    public void eat(){
        System.out.println(name+" 正在吃饭");
    }
}
class Dog extends Animal{
    public Dog(String myname,int myage){
        super(myname,myage);
        System.out.println("Dog（子类）的构造");
    }
    static{
        System.out.println("Dog（子类）的静态代码块");
    }
    {
        System.out.println("Dog（子类）的实例代码块");
    }
    public void bark(){
        System.out.println(name+" 正在叫");
    }
}
public class Main {
    public static void main(String[] args) {
        Dog dog=new Dog("小狗",10);
    }
}
class Base{
    public int a=20;
    public int b=10;
}
class Derived extends Base{
    public int a=15;
    public int c=5;
    public void method(){
        System.out.println(a+" "+b+" "+c);
    }
}
class Main2{
    public static void main(String[] args) {
        Derived m=new Derived();
        m.method();
    }
}
